package com.wdc.redblacktree;

import static com.wdc.redblacktree.RedBlackTree.Color.RED;

/**
 * 红黑树
 */
public class RedBlackTree {

    enum Color{
        RED, BLACK;
    }

    private Node node;

    private static class Node{
        int key;
        Object  value;
        Node left;
        Node right;
        Node parent;
        Color color = RED;


        //是否是左孩子
        boolean isLeftChild(){

            return parent != null && parent.left == this;
        }

        //叔叔
        Node uncle(){
            if (parent != null || parent.parent == null){
                return null;
            }
            if (parent.isLeftChild()){
                return parent.parent.right;
            }else {
                return parent.parent.left;
            }
        }

        //兄弟
        Node sibling(){
            if (parent == null){
                return null;
            }
            if (this.isLeftChild()){
                return parent.right;
            }else {
                return parent.left;
            }
        }

    }

    //判断结点是什么颜色

    //右旋


}
